#pragma once
// MESSAGE SET_PID1 PACKING

#define MAVLINK_MSG_ID_SET_PID1 191

MAVPACKED(
typedef struct __mavlink_set_pid1_t {
 int16_t pid1_p; /*<  PID1_P*/
 int16_t pid1_i; /*<  PID1_I*/
 int16_t pid1_d; /*<  PID1_D*/
 int16_t pid2_p; /*<  PID2_P*/
 int16_t pid2_i; /*<  PID2_I*/
 int16_t pid2_d; /*<  PID2_D*/
 int16_t pid3_p; /*<  PID3_P*/
 int16_t pid3_i; /*<  PID3_I*/
 int16_t pid3_d; /*<  PID3_D*/
}) mavlink_set_pid1_t;

#define MAVLINK_MSG_ID_SET_PID1_LEN 18
#define MAVLINK_MSG_ID_SET_PID1_MIN_LEN 18
#define MAVLINK_MSG_ID_191_LEN 18
#define MAVLINK_MSG_ID_191_MIN_LEN 18

#define MAVLINK_MSG_ID_SET_PID1_CRC 50
#define MAVLINK_MSG_ID_191_CRC 50



#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_SET_PID1 { \
    191, \
    "SET_PID1", \
    9, \
    {  { "pid1_p", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_set_pid1_t, pid1_p) }, \
         { "pid1_i", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_set_pid1_t, pid1_i) }, \
         { "pid1_d", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_set_pid1_t, pid1_d) }, \
         { "pid2_p", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_set_pid1_t, pid2_p) }, \
         { "pid2_i", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_set_pid1_t, pid2_i) }, \
         { "pid2_d", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_set_pid1_t, pid2_d) }, \
         { "pid3_p", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_set_pid1_t, pid3_p) }, \
         { "pid3_i", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_set_pid1_t, pid3_i) }, \
         { "pid3_d", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_set_pid1_t, pid3_d) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_SET_PID1 { \
    "SET_PID1", \
    9, \
    {  { "pid1_p", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_set_pid1_t, pid1_p) }, \
         { "pid1_i", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_set_pid1_t, pid1_i) }, \
         { "pid1_d", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_set_pid1_t, pid1_d) }, \
         { "pid2_p", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_set_pid1_t, pid2_p) }, \
         { "pid2_i", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_set_pid1_t, pid2_i) }, \
         { "pid2_d", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_set_pid1_t, pid2_d) }, \
         { "pid3_p", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_set_pid1_t, pid3_p) }, \
         { "pid3_i", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_set_pid1_t, pid3_i) }, \
         { "pid3_d", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_set_pid1_t, pid3_d) }, \
         } \
}
#endif

/**
 * @brief Pack a set_pid1 message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param pid1_p  PID1_P
 * @param pid1_i  PID1_I
 * @param pid1_d  PID1_D
 * @param pid2_p  PID2_P
 * @param pid2_i  PID2_I
 * @param pid2_d  PID2_D
 * @param pid3_p  PID3_P
 * @param pid3_i  PID3_I
 * @param pid3_d  PID3_D
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_set_pid1_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               int16_t pid1_p, int16_t pid1_i, int16_t pid1_d, int16_t pid2_p, int16_t pid2_i, int16_t pid2_d, int16_t pid3_p, int16_t pid3_i, int16_t pid3_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID1_LEN];
    _mav_put_int16_t(buf, 0, pid1_p);
    _mav_put_int16_t(buf, 2, pid1_i);
    _mav_put_int16_t(buf, 4, pid1_d);
    _mav_put_int16_t(buf, 6, pid2_p);
    _mav_put_int16_t(buf, 8, pid2_i);
    _mav_put_int16_t(buf, 10, pid2_d);
    _mav_put_int16_t(buf, 12, pid3_p);
    _mav_put_int16_t(buf, 14, pid3_i);
    _mav_put_int16_t(buf, 16, pid3_d);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_PID1_LEN);
#else
    mavlink_set_pid1_t packet;
    packet.pid1_p = pid1_p;
    packet.pid1_i = pid1_i;
    packet.pid1_d = pid1_d;
    packet.pid2_p = pid2_p;
    packet.pid2_i = pid2_i;
    packet.pid2_d = pid2_d;
    packet.pid3_p = pid3_p;
    packet.pid3_i = pid3_i;
    packet.pid3_d = pid3_d;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_PID1_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_SET_PID1;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_PID1_MIN_LEN, MAVLINK_MSG_ID_SET_PID1_LEN, MAVLINK_MSG_ID_SET_PID1_CRC);
}

/**
 * @brief Pack a set_pid1 message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param pid1_p  PID1_P
 * @param pid1_i  PID1_I
 * @param pid1_d  PID1_D
 * @param pid2_p  PID2_P
 * @param pid2_i  PID2_I
 * @param pid2_d  PID2_D
 * @param pid3_p  PID3_P
 * @param pid3_i  PID3_I
 * @param pid3_d  PID3_D
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_set_pid1_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   int16_t pid1_p,int16_t pid1_i,int16_t pid1_d,int16_t pid2_p,int16_t pid2_i,int16_t pid2_d,int16_t pid3_p,int16_t pid3_i,int16_t pid3_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID1_LEN];
    _mav_put_int16_t(buf, 0, pid1_p);
    _mav_put_int16_t(buf, 2, pid1_i);
    _mav_put_int16_t(buf, 4, pid1_d);
    _mav_put_int16_t(buf, 6, pid2_p);
    _mav_put_int16_t(buf, 8, pid2_i);
    _mav_put_int16_t(buf, 10, pid2_d);
    _mav_put_int16_t(buf, 12, pid3_p);
    _mav_put_int16_t(buf, 14, pid3_i);
    _mav_put_int16_t(buf, 16, pid3_d);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_PID1_LEN);
#else
    mavlink_set_pid1_t packet;
    packet.pid1_p = pid1_p;
    packet.pid1_i = pid1_i;
    packet.pid1_d = pid1_d;
    packet.pid2_p = pid2_p;
    packet.pid2_i = pid2_i;
    packet.pid2_d = pid2_d;
    packet.pid3_p = pid3_p;
    packet.pid3_i = pid3_i;
    packet.pid3_d = pid3_d;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_PID1_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_SET_PID1;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_PID1_MIN_LEN, MAVLINK_MSG_ID_SET_PID1_LEN, MAVLINK_MSG_ID_SET_PID1_CRC);
}

/**
 * @brief Encode a set_pid1 struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param set_pid1 C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_set_pid1_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_pid1_t* set_pid1)
{
    return mavlink_msg_set_pid1_pack(system_id, component_id, msg, set_pid1->pid1_p, set_pid1->pid1_i, set_pid1->pid1_d, set_pid1->pid2_p, set_pid1->pid2_i, set_pid1->pid2_d, set_pid1->pid3_p, set_pid1->pid3_i, set_pid1->pid3_d);
}

/**
 * @brief Encode a set_pid1 struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param set_pid1 C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_set_pid1_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_pid1_t* set_pid1)
{
    return mavlink_msg_set_pid1_pack_chan(system_id, component_id, chan, msg, set_pid1->pid1_p, set_pid1->pid1_i, set_pid1->pid1_d, set_pid1->pid2_p, set_pid1->pid2_i, set_pid1->pid2_d, set_pid1->pid3_p, set_pid1->pid3_i, set_pid1->pid3_d);
}

/**
 * @brief Send a set_pid1 message
 * @param chan MAVLink channel to send the message
 *
 * @param pid1_p  PID1_P
 * @param pid1_i  PID1_I
 * @param pid1_d  PID1_D
 * @param pid2_p  PID2_P
 * @param pid2_i  PID2_I
 * @param pid2_d  PID2_D
 * @param pid3_p  PID3_P
 * @param pid3_i  PID3_I
 * @param pid3_d  PID3_D
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_set_pid1_send(mavlink_channel_t chan, int16_t pid1_p, int16_t pid1_i, int16_t pid1_d, int16_t pid2_p, int16_t pid2_i, int16_t pid2_d, int16_t pid3_p, int16_t pid3_i, int16_t pid3_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID1_LEN];
    _mav_put_int16_t(buf, 0, pid1_p);
    _mav_put_int16_t(buf, 2, pid1_i);
    _mav_put_int16_t(buf, 4, pid1_d);
    _mav_put_int16_t(buf, 6, pid2_p);
    _mav_put_int16_t(buf, 8, pid2_i);
    _mav_put_int16_t(buf, 10, pid2_d);
    _mav_put_int16_t(buf, 12, pid3_p);
    _mav_put_int16_t(buf, 14, pid3_i);
    _mav_put_int16_t(buf, 16, pid3_d);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID1, buf, MAVLINK_MSG_ID_SET_PID1_MIN_LEN, MAVLINK_MSG_ID_SET_PID1_LEN, MAVLINK_MSG_ID_SET_PID1_CRC);
#else
    mavlink_set_pid1_t packet;
    packet.pid1_p = pid1_p;
    packet.pid1_i = pid1_i;
    packet.pid1_d = pid1_d;
    packet.pid2_p = pid2_p;
    packet.pid2_i = pid2_i;
    packet.pid2_d = pid2_d;
    packet.pid3_p = pid3_p;
    packet.pid3_i = pid3_i;
    packet.pid3_d = pid3_d;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID1, (const char *)&packet, MAVLINK_MSG_ID_SET_PID1_MIN_LEN, MAVLINK_MSG_ID_SET_PID1_LEN, MAVLINK_MSG_ID_SET_PID1_CRC);
#endif
}

/**
 * @brief Send a set_pid1 message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_set_pid1_send_struct(mavlink_channel_t chan, const mavlink_set_pid1_t* set_pid1)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_set_pid1_send(chan, set_pid1->pid1_p, set_pid1->pid1_i, set_pid1->pid1_d, set_pid1->pid2_p, set_pid1->pid2_i, set_pid1->pid2_d, set_pid1->pid3_p, set_pid1->pid3_i, set_pid1->pid3_d);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID1, (const char *)set_pid1, MAVLINK_MSG_ID_SET_PID1_MIN_LEN, MAVLINK_MSG_ID_SET_PID1_LEN, MAVLINK_MSG_ID_SET_PID1_CRC);
#endif
}

#if MAVLINK_MSG_ID_SET_PID1_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_set_pid1_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  int16_t pid1_p, int16_t pid1_i, int16_t pid1_d, int16_t pid2_p, int16_t pid2_i, int16_t pid2_d, int16_t pid3_p, int16_t pid3_i, int16_t pid3_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_int16_t(buf, 0, pid1_p);
    _mav_put_int16_t(buf, 2, pid1_i);
    _mav_put_int16_t(buf, 4, pid1_d);
    _mav_put_int16_t(buf, 6, pid2_p);
    _mav_put_int16_t(buf, 8, pid2_i);
    _mav_put_int16_t(buf, 10, pid2_d);
    _mav_put_int16_t(buf, 12, pid3_p);
    _mav_put_int16_t(buf, 14, pid3_i);
    _mav_put_int16_t(buf, 16, pid3_d);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID1, buf, MAVLINK_MSG_ID_SET_PID1_MIN_LEN, MAVLINK_MSG_ID_SET_PID1_LEN, MAVLINK_MSG_ID_SET_PID1_CRC);
#else
    mavlink_set_pid1_t *packet = (mavlink_set_pid1_t *)msgbuf;
    packet->pid1_p = pid1_p;
    packet->pid1_i = pid1_i;
    packet->pid1_d = pid1_d;
    packet->pid2_p = pid2_p;
    packet->pid2_i = pid2_i;
    packet->pid2_d = pid2_d;
    packet->pid3_p = pid3_p;
    packet->pid3_i = pid3_i;
    packet->pid3_d = pid3_d;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID1, (const char *)packet, MAVLINK_MSG_ID_SET_PID1_MIN_LEN, MAVLINK_MSG_ID_SET_PID1_LEN, MAVLINK_MSG_ID_SET_PID1_CRC);
#endif
}
#endif

#endif

// MESSAGE SET_PID1 UNPACKING


/**
 * @brief Get field pid1_p from set_pid1 message
 *
 * @return  PID1_P
 */
static inline int16_t mavlink_msg_set_pid1_get_pid1_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  0);
}

/**
 * @brief Get field pid1_i from set_pid1 message
 *
 * @return  PID1_I
 */
static inline int16_t mavlink_msg_set_pid1_get_pid1_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  2);
}

/**
 * @brief Get field pid1_d from set_pid1 message
 *
 * @return  PID1_D
 */
static inline int16_t mavlink_msg_set_pid1_get_pid1_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  4);
}

/**
 * @brief Get field pid2_p from set_pid1 message
 *
 * @return  PID2_P
 */
static inline int16_t mavlink_msg_set_pid1_get_pid2_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  6);
}

/**
 * @brief Get field pid2_i from set_pid1 message
 *
 * @return  PID2_I
 */
static inline int16_t mavlink_msg_set_pid1_get_pid2_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  8);
}

/**
 * @brief Get field pid2_d from set_pid1 message
 *
 * @return  PID2_D
 */
static inline int16_t mavlink_msg_set_pid1_get_pid2_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  10);
}

/**
 * @brief Get field pid3_p from set_pid1 message
 *
 * @return  PID3_P
 */
static inline int16_t mavlink_msg_set_pid1_get_pid3_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  12);
}

/**
 * @brief Get field pid3_i from set_pid1 message
 *
 * @return  PID3_I
 */
static inline int16_t mavlink_msg_set_pid1_get_pid3_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  14);
}

/**
 * @brief Get field pid3_d from set_pid1 message
 *
 * @return  PID3_D
 */
static inline int16_t mavlink_msg_set_pid1_get_pid3_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  16);
}

/**
 * @brief Decode a set_pid1 message into a struct
 *
 * @param msg The message to decode
 * @param set_pid1 C-struct to decode the message contents into
 */
static inline void mavlink_msg_set_pid1_decode(const mavlink_message_t* msg, mavlink_set_pid1_t* set_pid1)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    set_pid1->pid1_p = mavlink_msg_set_pid1_get_pid1_p(msg);
    set_pid1->pid1_i = mavlink_msg_set_pid1_get_pid1_i(msg);
    set_pid1->pid1_d = mavlink_msg_set_pid1_get_pid1_d(msg);
    set_pid1->pid2_p = mavlink_msg_set_pid1_get_pid2_p(msg);
    set_pid1->pid2_i = mavlink_msg_set_pid1_get_pid2_i(msg);
    set_pid1->pid2_d = mavlink_msg_set_pid1_get_pid2_d(msg);
    set_pid1->pid3_p = mavlink_msg_set_pid1_get_pid3_p(msg);
    set_pid1->pid3_i = mavlink_msg_set_pid1_get_pid3_i(msg);
    set_pid1->pid3_d = mavlink_msg_set_pid1_get_pid3_d(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_SET_PID1_LEN? msg->len : MAVLINK_MSG_ID_SET_PID1_LEN;
        memset(set_pid1, 0, MAVLINK_MSG_ID_SET_PID1_LEN);
    memcpy(set_pid1, _MAV_PAYLOAD(msg), len);
#endif
}
